/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.jfonia.pitch;

import org.jfonia.connect5.basics.BasicValueNode;
import org.jfonia.connect5.basics.MutableValueNode;
import org.jfonia.connect5.basics.Observer;
import org.jfonia.model.elements.Clef.Type;

/**
 *
 * @author Rik Bauwens
 */
public class ClefNode extends BasicValueNode<Integer>
{
        public ClefNode(final MutableValueNode<Type> typeNode)
        {
                super(Type.toInt(typeNode.getValue()));
                typeNode.addObserver(new Observer()
                {
                        public void onNotify(Object source)
                        {
                                Type.toInt(typeNode.getValue());
                        }
                });
                addObserver(new Observer()
                {
                        public void onNotify(Object source)
                        {
                                typeNode.setValue(Type.toType(getValue()));
                        }
                });
        }
}
